UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h/3DP7XBW5RxOhgbFugqo6yOE2mN8oKS4mwbpxOienY=' 
WHERE 
  key_id = '47ab5113bdc8a36b41baf0524a34d18cc7d1c2bb0deec26e9e719f327b402aad' 
  AND (
    token = 'h/3DP7XBW5RxOhgbFugqo6yOE2mN8oKS4mwbpxOienY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044