UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HDhkvx5qsVGwZTYV4+/FIq42LPOLHkemlsz830jtCqk=' 
WHERE 
  key_id = 'c2a600af133bcff04c511235954910929d012ec7b75c54a80e4c02467e3070db' 
  AND (
    token = 'HDhkvx5qsVGwZTYV4+/FIq42LPOLHkemlsz830jtCqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048