UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aJdLhZVDqBwNjWf2Ck8wB0JEE6u0CH9/HuBznFOzr+A=' 
WHERE 
  key_id = 'd7e490f0643a3c6c4437b144539faff9abb970e1859713d7b16add02841947b4' 
  AND (
    token = 'aJdLhZVDqBwNjWf2Ck8wB0JEE6u0CH9/HuBznFOzr+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048