UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xa3dihgSaQfsIXVzEw9eJ5weGXY8y50gYfe5DwRGUYg=' 
WHERE 
  key_id = '26d79a6eddb4df6908af343f7244028b3314591569f4d2a9dd548f5bfe971436' 
  AND (
    token = 'Xa3dihgSaQfsIXVzEw9eJ5weGXY8y50gYfe5DwRGUYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038