UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bm0KjUjT4Tx1xGRl5GcMg+miAMi7Ze56EQqhBOFiBaA=' 
WHERE 
  key_id = '3fc4d7997bed430031e0157e2d288d5b5e1fda95cf84b2b111a960d04e3dfbee' 
  AND (
    token = 'Bm0KjUjT4Tx1xGRl5GcMg+miAMi7Ze56EQqhBOFiBaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048