UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sLFBq4k0SMyHndqAmtBeoJPy76uEzTHtQCbVNOWQmKo=' 
WHERE 
  key_id = '051d67db4171489e8a916561fa773cd96dd6b7fa5da217adc161c77f9b576f44' 
  AND (
    token = 'sLFBq4k0SMyHndqAmtBeoJPy76uEzTHtQCbVNOWQmKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022