UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NXQk+ZeN9dUegrGXXEXDErqTqhgumI3v9kBUl/CmwvQ=' 
WHERE 
  key_id = 'aeabd4433a3c700c9f6a6e2fb7e410016893b0b2b753d6eb20de0ea0728e40e5' 
  AND (
    token = 'NXQk+ZeN9dUegrGXXEXDErqTqhgumI3v9kBUl/CmwvQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042