UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Owwd0O+N22d6Lc2xM5qzZqhaYHpbb61KYW4xaQO1beQ=' 
WHERE 
  key_id = '21a9ade569c460d4e1453a5e6efe38d6443b873714e01151786f95bf5eec0204' 
  AND (
    token = 'Owwd0O+N22d6Lc2xM5qzZqhaYHpbb61KYW4xaQO1beQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033