UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6C1F4y2NTF1mljQQfaNEGOYwbttgBMlNTUfY58B8qmI=' 
WHERE 
  key_id = '10c4e07c02a69e65e6d3686b9deeed46a90470ec6ea6db461c55ac0936892b0a' 
  AND (
    token = '6C1F4y2NTF1mljQQfaNEGOYwbttgBMlNTUfY58B8qmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032