UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lG7UyFB1ECGL6hj7lKmQ37AwLsxWAi0U41q+vm8vbbQ=' 
WHERE 
  key_id = '17091972473a5e4c01726607ecbf6e77445d62ac2e74d0bfe6a58dac53e470ce' 
  AND (
    token = 'lG7UyFB1ECGL6hj7lKmQ37AwLsxWAi0U41q+vm8vbbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041