UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n0LnALFf2XlYbGJpQG5r6f3/MnIuY/5OiQ+gD7ajdgo=' 
WHERE 
  key_id = '91b6a043c8890ed6aacf4d2a034e530fe213cea79579074b378afc449067e393' 
  AND (
    token = 'n0LnALFf2XlYbGJpQG5r6f3/MnIuY/5OiQ+gD7ajdgo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030