UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pt0iA2rl1g5zIh4rvXGpEFtHGXt+z88Vv0Yn0OBhGYs=' 
WHERE 
  key_id = '466d5127809183149814cb67892d5e9888affc6009fee831443793ebb86bbd48' 
  AND (
    token = 'Pt0iA2rl1g5zIh4rvXGpEFtHGXt+z88Vv0Yn0OBhGYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030