UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f3lIdttf4oJyOnWsXC83d6XNsedbE7m8wqfCCteC10k=' 
WHERE 
  key_id = 'c70da7a3deab1a774830cb33bb0c22f505b884babce74885f8a8bebd946797ee' 
  AND (
    token = 'f3lIdttf4oJyOnWsXC83d6XNsedbE7m8wqfCCteC10k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046