UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tx7/0e+7E/Yv4VC2YLpJVh69B6tYyRXhMv7hyJnZrwk=' 
WHERE 
  key_id = '7b99d7490e1291df087beee9efb738de8c50760eb336adc80045b40d7092c54e' 
  AND (
    token = 'Tx7/0e+7E/Yv4VC2YLpJVh69B6tYyRXhMv7hyJnZrwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023