UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'doXSYjEHA8VAYoph1MSKckZCq24LHBsCsbAAyw6icBI=' 
WHERE 
  key_id = '004515b0bb204c19ba021ee9a28df7ef0d608a6cd8b69b1389897c4668032902' 
  AND (
    token = 'doXSYjEHA8VAYoph1MSKckZCq24LHBsCsbAAyw6icBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078