UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n6PBB+R3w/AjqESn8HKPqslseKclEEJjQDYW44IXCGU=' 
WHERE 
  key_id = 'd0c4c9b78d277c38f6fc6c06b215de74d049eba68d26114bcabcfb7997f69789' 
  AND (
    token = 'n6PBB+R3w/AjqESn8HKPqslseKclEEJjQDYW44IXCGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028