UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3O4WZhKICfBNTNG2iHWlu4mKYYnvzEYdvty0Mu159jQ=' 
WHERE 
  key_id = '6e503d567fe552271e92038c0be6145664b33b31842b936ffb0dae5f521ff839' 
  AND (
    token = '3O4WZhKICfBNTNG2iHWlu4mKYYnvzEYdvty0Mu159jQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023