UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zqL5XNbb2jg0yLxuA7GWQuHydV68GOgtEecTLJaAz6o=' 
WHERE 
  key_id = '4dbdc2b444337b947551827c10a1a15cb0e7d82931431f9faf7b0e1c8ed87887' 
  AND (
    token = 'zqL5XNbb2jg0yLxuA7GWQuHydV68GOgtEecTLJaAz6o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024