UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pXSzCq1TF0zV2rsjppk38PZRsv0ueIQ1cUsjlYiF9yk=' 
WHERE 
  key_id = '39bd55b8aeca7e50813ec0c88a12e6d44dc9ebc77b428b657509c339c854f4fe' 
  AND (
    token = 'pXSzCq1TF0zV2rsjppk38PZRsv0ueIQ1cUsjlYiF9yk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046