UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WiFju5yQNXLXE2mHxezk7k55HWlXSQxOPBOBxQSO+Zo=' 
WHERE 
  key_id = 'ae4b4c0849e182be11a991fe959f3d032c97c86b25f427bc953d86519cd89d57' 
  AND (
    token = 'WiFju5yQNXLXE2mHxezk7k55HWlXSQxOPBOBxQSO+Zo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050