UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q6jnKXalXc7keqCxbCboHKbFh3opfGPeDJFAxyxAC0M=' 
WHERE 
  key_id = '44a3771912979bd1f6ce4ba1f1f1bcff78ea8b95c4419ddb80ecf605f058ee28' 
  AND (
    token = 'Q6jnKXalXc7keqCxbCboHKbFh3opfGPeDJFAxyxAC0M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035