UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dkgCXAxHw1lgxJ+R5cGMKxjLhdA0acnit+R0yQ6iMqk=' 
WHERE 
  key_id = 'af345946c90874c43e3d7cd3b5194e455ffcf254aefce31e7522cc1ab83e74e9' 
  AND (
    token = 'dkgCXAxHw1lgxJ+R5cGMKxjLhdA0acnit+R0yQ6iMqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022