UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aJ1VdcZrSotptT1RLzNPCNHdzrHVvaj0FNBeAlM4zEo=' 
WHERE 
  key_id = '9b3694cf6d5ee88451a2607615714bf6443971faaf5b3cad7d7c9837d3d76955' 
  AND (
    token = 'aJ1VdcZrSotptT1RLzNPCNHdzrHVvaj0FNBeAlM4zEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048